<script>
	import Vue from 'vue'
	const normalPlatformList = ['ios', 'android', 'devtools']
	export default {
		onLaunch: function() {
			uni.getSystemInfo({
				success: function(e) {
					// #ifndef MP
					Vue.prototype.StatusBar = e.statusBarHeight
					if (e.platform == 'android') {
						Vue.prototype.CustomBar = e.statusBarHeight + 50
					} else {
						Vue.prototype.CustomBar = e.statusBarHeight + 45
					}
					// #endif
					// #ifdef MP-WEIXIN
					Vue.prototype.StatusBar = e.statusBarHeight
					let custom = wx.getMenuButtonBoundingClientRect();
					console.log("======胶囊=====");
					console.log(custom);
					Vue.prototype.Custom = custom
					Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight
					Vue.prototype.CustomTitleBar = custom.height + (custom.top - e.statusBarHeight)*2
					Vue.prototype.CustomTitleBarRight = custom.width + 10;
					// #endif
					// #ifdef MP-ALIPAY
					Vue.prototype.StatusBar = e.statusBarHeight
					Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight
					Vue.prototype.CustomTitleBar = e.titleBarHeight
					Vue.prototype.CustomTitleBarRight = 0;
					// #endif
					let unitRatio = 750 / uni.getSystemInfoSync().windowWidth
					Vue.prototype.StatusBarRpx = Vue.prototype.StatusBar * unitRatio
					Vue.prototype.CustomBarRpx = Vue.prototype.CustomBar * unitRatio
					Vue.prototype.unitRatio = unitRatio
					Vue.prototype.CustomTitleBar = Vue.prototype.CustomBarRpx - Vue.prototype.StatusBarRpx;
					Vue.prototype.CustomTitleBarRight = Vue.prototype.CustomTitleBarRight * unitRatio
					Vue.mixin({
						data() {
							return {
								StatusBar: Vue.prototype.StatusBar, //状态栏高度(px)
								CustomBar: Vue.prototype.CustomBar, //整个标题栏高度(px)
								StatusBarRpx: Vue.prototype.StatusBarRpx, //状态栏高度(rpx)
								CustomBarRpx: Vue.prototype.CustomBarRpx, //整个标题栏高度(rpx)
								CustomTitleBar: Vue.prototype.CustomTitleBar,
								CustomTitleBarRight: Vue.prototype.CustomTitleBarRight,
							}
						},
					})
				},
			})
		},
		onShow(options) {
			const scene = decodeURIComponent(options.scene); //这里的值就是二维码里带的参数值
			// alert(scene);
			if (scene == 1047 || scene == 1048 || scene == 1049 || scene == 1001) {
				''
				const share_ma = decodeURIComponent(options.query.share_ma)
				if (share_ma != 'undefined' && share_ma != 'null') {
					console.log("App-share_ma: " + JSON.stringify(share_ma));
					uni.setStorageSync('share_ma', share_ma);
				}
				// 	// let user = uni.getStorageSync("user")
				// 	// if (!user) {
				// 	// 	uni.navigateTo({
				// 	// 		url: `/pages/my/login?share_ma=${share_code}`
				// 	// 	});
				// 	// }
			}
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "uview-ui/index.scss";
	@import url("static/css/base.scss");
	table {
		width: 100% !important;
	}
	uni-toast {
		z-index: 999999999999;
	}
	::v-deep .u-tabbar__content__item__text text {
		font-size: 20rpx;
		line-height: 23rpx;
	}
	::v-deep .u-tabbar__content__circle__button{
		background-color: transparent !important;
	}
	// @font-face {
	// 	font-family: "myfont";
	// 	src: url('@/font/YouSheBiaoTiHei.ttf') format("truetype");
	// }
</style>